import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { ContractBasicVO, ContractBasicForm, ContractBasicQuery } from '@/api/nursing/contractBasic/types';

/**
 * 查询合同信息列表
 * @param query
 * @returns {*}
 */

export const listContractBasic = (query?: ContractBasicQuery): AxiosPromise<ContractBasicVO[]> => {
  return request({
    url: '/nursing/contractBasic/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询合同信息详细
 * @param contractId
 */
export const getContractBasic = (contractId: string | number): AxiosPromise<ContractBasicVO> => {
  return request({
    url: '/nursing/contractBasic/' + contractId,
    method: 'get'
  });
};

/**
 * 新增合同信息
 * @param data
 */
export const addContractBasic = (data: ContractBasicForm) => {
  return request({
    url: '/nursing/contractBasic',
    method: 'post',
    data: data
  });
};

/**
 * 修改合同信息
 * @param data
 */
export const updateContractBasic = (data: ContractBasicForm) => {
  return request({
    url: '/nursing/contractBasic',
    method: 'put',
    data: data
  });
};

/**
 * 删除合同信息
 * @param contractId
 */
export const delContractBasic = (contractId: string | number | Array<string | number>) => {
  return request({
    url: '/nursing/contractBasic/' + contractId,
    method: 'delete'
  });
};
